package com.by.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RefreshScope
public class OrderController {
    @Value("${weixin.appId}")
    private String appId;

    @Value("${weixin.appSecrect}")
    private String appSecrect;

    @Value("${weixin.nickName:李华}")
    private String nickName;


    @Value("${spring.application.name}")
    private String appName;

    @Autowired
    private  RestTemplate restTemplate;
    @GetMapping("/test2")
    public String test2(){
        String str = restTemplate.getForObject("https://httpbin.org/get?id={id}&name={name}", String.class, 1,"小龙");
        return appName;
    }

    @GetMapping("/test")
    public String test(){
        return "appId:"+appId+"appSecrect:"+appSecrect+"nickName:"+nickName;
    }
}
